<?php 

/**
* 简历管理第二阶段
*/
class Resume2Model extends Model
{
	public $table = 'people_resume2';

	//array(' 表单字段名 ',' 验证方法 ',' 错误信息 ',' 验证条件 ',' 验证时机 ')
	public $validate =array(
		array('workplace','maxlen:20','工作地址过长',3,3),
		array('quality','num:1,3','岗位性质选择错误',2,3),
		array('salary','num:1,7','薪资待遇选择错误',2,3),
		array('posid', "nonull", "期望岗位必选",2,3)
		);
	//array(' 数据字段名 ',' 处理方法 ',' 方法类型 ',' 验证条件 ',' 处理时机 ')
	public $auto = array(
		array('resume1_reid','_reid','method',2,3),
		array('city_cityid','_city_cityid','method',2,3)
		);

	/**
	 * 获取reid
	 */
	public function _reid()
	{
		return Q('post.reid',0,'intval');
	}

	/**
	 * 自动完成
	 * @return [type] [description]
	 */
	public function _city_cityid()
	{
		$city_one = Q('post.city_one',0,'intval');
		$city_second = Q('post.city_second',0,'intval');

		if($city_second != 0) return $city_second;
		return $city_one;
	}


	public function have_info($reid)
	{
		$res = $this->where(array('resume1_reid'=>$reid))->getField('resume1_reid');

		// p($res);exit;
		return $res;
	}

	public function get_data($reid)
	{
		
		$res = $this->where(array('resume1_reid'=>$reid))->find();

		// p($res);exit;
		return $res;
	}

	public function add_data()
	{
		return $this->add();
	}


	function update_data($reid)
	{
		$where = array(
			'resume1_reid'=>$reid,
			);

		return $this->where($where)->save();
	}
}

 ?>